package com.joshondesign.sdljava.demo;

import com.joshondesign.sdljava.*;
import com.joshondesign.sdljava.gfx.*;

/**
 * Created by IntelliJ IDEA.
 * User: josh
 * Date: 9/6/11
 * Time: 10:05 AM
 * To change this template use File | Settings | File Templates.
 */
public class Demo5 implements SDLUtil.InitCallback {
    public static void main(String ... args) {
        SDLUtil.init(new Demo5());
    }

    public void callback() {
        try {
            Util.standard_init();
            Util.dump(SDL.SDL_GetVideoInfo());
            SDL_Surface surface= Util.createResizableWindow(800, 600);

            Scene scene = new Scene(surface);
            Layer l1 = new Layer(surface.getFormat());
            scene.add(l1);

            SColor RED = new SColor(255,0,0);
            SColor GREEN = new SColor(0,255,0);

            Rect r1 = new Rect(200,100,50,50,RED);
            l1.add(r1);
            l1.add(new Rect(200, 400, 100, 30, GREEN));

            Layer l2 = new Layer(surface.getFormat());
            l2.add(new Rect(400,300,20,40,GREEN));
            l2.x = 30;
            l2.y = 30;
            scene.add(l2);


            scene.animate(new PropAnimation(r1,"x",0,500,10.0));
            scene.start();
        } catch (SDLException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

    }


}
